#include <iostream>

#include "graph.h"
#include "mySolution.h"
#include "myTwoOpt.h"
#include "myTwoOptMoveRandom.h"
#include "edaExpCoolingSchedule.h"
#include "edaSA.h"
#include "edaGenContinue.h"
#include "edaTimeContinue.h"

int main(int argc, char **argv)
{
  if (argc != 2)
  {
    std::cerr << "Usage : ./mySASearch [instance]" << std::endl;
    return 1;
  }

  srand(1000);

  Graph graph;

  graph.load(argv[1]);

  mySolution route(graph);

  std::cout << "[From] " << route << std::endl;

  myTwoOpt two_opt(graph);
  myTwoOptMoveRandom two_opt_random(graph);
  edaExpCoolingSchedule coolingSchedule(0.001, 0.990);
  edaGenContinue cont_criteria(500);
  //edaTimeContinue cont_criteria(1);

  edaSA saSearch(&two_opt, &two_opt_random, &cont_criteria, 1100.0, &coolingSchedule);
  saSearch.search(route);

  std::cout << "[To] " << route << std::endl;
  std::cout << "[To Fitness] " << route.fullEvaluate() << std::endl;

  return 0;
}
